<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<!-- If HomePage controller returns 'index', /WEB-INF/views/index.jsp is shown
	$ {param} - parameters filled by the Controller returning 'index'
  -->
<html>

<head>
<title>Gabriel Varga DSV</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/resources/css/screen.css"/>" />
</head>

<body>
	<div id="container">
		<div class="dualbrand">
			<img src="<c:url value="/static/resources/gfx/fit.png"/>  " />
		</div>
		<div id="content">
			<h1>Welcome to DSV RMI SERVER!</h1>
			<div>
				<p>
					Aktualne je pripojenych <strong> ${rmiNodes.size()} </strong> RMI uzlov
				</p>
			</div>

			<div>
				<p>
					Aktualna hodnota premennej je <strong>${currentValue}</strong>.
					<br />
					Posledna zmena od ${lastChange} [${lastChangeDate}]
				</p>
			</div>

			<h2>Zakladne udaje</h2>
			<table class="simpletablestyle lessWidth">
				<tr>
					<td>Meno</td>
					<td>${thisNode.name}</td>
				</tr>
				<tr>
					<td>IP</td>
					<td>${thisNode.ipAddress}:${thisNode.port}</td>
				</tr>
				<tr>
					<td>Url</td>
					<td><a href="<c:url value="../${thisNode.url}"/>" target="_blank" />Odkaz</td>
				</tr>
			</table>

			<h2>Ostatne Uzly</h2>
			<c:choose>
				<c:when test="${rmiNodes.size()==0}">
					<em>No registered RMI nodes.</em>
				</c:when>
				<c:otherwise>
					<table class="simpletablestyle">
						<thead>
							<tr>
								<th>Name</th>
								<th>IP adress</th>
								<th>Url</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${rmiNodes}" var="rmiNode">
								<tr>
									<td>${rmiNode.value.name}</td>
									<td>${rmiNode.value.ipAddress}:${rmiNode.value.port}</td>
									<td><a target="_blank" href="<c:url value="../${rmiNode.value.url}"/>">Odkaz</a></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</c:otherwise>
			</c:choose>

			<h2>Log</h2>
			<table class="simpletablestyle">
				<thead>
					<tr>
						<th>Date</th>
						<th>Text</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${logs}" var="log">
						<tr>
							<td>${log.timeMillis}</td>
							<td>${log.text}</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<br/>
			<a target="_blank" href="<c:url value="/report"/>">Log ako PDF</a>

		</div>
		
		<div id="footer">
			<p>Projekt MI-DSV, Gabriel Varga, vargagab@fit.cvut.cz</p>
		</div>
		
	</div>
</body>
</html>
